const TOKEN_PREFIX = "TOKEN"

function getTokenKey() {
	return `_B2ZG_APP_${TOKEN_PREFIX}`
}

/**
 * 设置token
 */
export const setToken = (token) => {
	const key = getTokenKey()
	uni.setStorageSync(key, token);
}

/**
 * 获取token
 */
export const getToken = function() {
	const key = getTokenKey()
	const token = uni.getStorageSync(key);
	return token ? `Bearer ${token}` : null
}

export const removeToken = () => {
	const key = getTokenKey()
	return uni.removeStorageSync(key);
}
